#{extends 'CRUD/layout.html' /}
#{set title:messages.get('nosologyType.edit') /}

<div id="crudShow" class="${type.name}">

    <h2 id="crudShowTitle">&{'nosologyType.edit'}</h2>

    <div class="objectForm">
    #{form action:@save(object._key()), enctype:'multipart/form-data'}
        #{crud.form fields:['nosologyTypeName', 'syndrome', 'nosologies']}
			#{crud.custom 'nosologies'}
	    		<label for="nosologies"><a href="@{Nosologys.list()}" class="nonUnderlined">&{'objects.nosologys'}</a></label>
	    		%{nosologies = models.Nosology.find("byNosologyType", object).fetch()}%
	    		#{if nosologies != null && !nosologies.isEmpty() }
	    		<div class="list">
					#{list items:nosologies, as:'nosology'}
						<li>
							<span id="${nosology.nosologyId}" class="hiddenLinks">
								@{Nosologys.show(nosology.nosologyId)}
					        </span>
					        ${nosology.nosologyName}
				        </li>
				    #{/list}
	    		</div>
	    		#{/if}
	    		#{else}
					&{'crud.list.empty'}	    		
	    		#{/else}
        	#{/crud.custom}
        #{/crud.form}
        <p class="crudButtons">
            <input type="submit" name="_save" value="&{'crud.save', type.modelName}" />
            <input type="submit" name="_saveAndContinue" value="&{'crud.saveAndContinue', type.modelName}" />
        </p>
    #{/form}
    </div>

    #{form @delete(object._key())}
        <p class="crudDelete">
            <input type="submit" value="&{'nosologyType.delete'}" onclick="return confirm('&{'nosologyType.delete'}')"/>
        </p>
    #{/form}

</div>